package com.sky.mapper;

import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper {

    /**
     * 根据分类id查询菜品数量
     * @param categoryId
     * @return
     */
    @Select("select count(id) from dish where category_id = #{categoryId}")
    Integer countByCategoryId(Long categoryId);
/*
* 添加菜品*/

    void save(Dish dish);



    @Select("select count(*) from dish")
    Integer count();

    List<DishVO> page(DishPageQueryDTO dishPageQueryDTO);

    void delete(List<Long> ids);

    @Select("select * from dish where id = #{i}")
    Dish selectById(Long i);

    void update(Dish dish);

    List<Dish> list(Dish dish);


    @Select("select * from dish where category_id = #{categoryId}")
    List<Dish> selectcateid(Long categoryId);
}
